package top.lshaci.learning.netty.rpc.provider;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import top.lshaci.learning.netty.rpc.common.HelloService;

/**
 * HelloServiceImpl
 *
 * @author lshaci
 * @since 1.0.0
 */
@Slf4j
public class HelloServiceImpl implements HelloService {

    private static int count;

    @Override
    public String hello(String msg) {
        log.debug("收到客户端消息: {}", msg);
        if (msg != null) {
            return StrUtil.format("你好客户端，我已经收到你的消息[{}] 第{}次", msg, ++count);
        } else {
            return "你好客户端，我已经收到你的消息";
        }
    }
}
